/* Theme variables */
:root {
  --bg: #0f1220;
  --bg-elev: #161a2e;
  --surface: #1b2040;
  --card: #1e2450;
  --text: #e9ecf1;
  --muted: #b8bfd0;
  --line: #2a2f57;

  --primary-300: #a786ff;
  --primary-500: #8a5ae6;
  --primary-700: #5b3cc4;
  --accent-500: #5aa5e6;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-1: 0 8px 24px rgba(0,0,0,0.25);
  --shadow-2: 0 16px 40px rgba(31, 38, 135, 0.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, "Noto Sans SC", system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #0d1020 0%, #0b0e19 100%);
  background-attachment: fixed;
  letter-spacing: 0.2px;
}

.container {
  width: min(1120px, 90%);
  margin: 0 auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(140%) blur(10px);
  background: rgba(18, 20, 36, 0.6);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0;
}
.brand { display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--text); }
.brand-text { display: grid; }
.brand-title { font-weight: 700; font-size: 18px; letter-spacing: 0.3px; }
.brand-sub { color: var(--muted); font-size: 12px; }
.menu { display: flex; gap: 20px; }
.menu a { color: var(--muted); text-decoration: none; font-weight: 500; padding: 8px 10px; border-radius: 10px; }
.menu a:hover { color: white; background: rgba(138,90,230,0.12); }

/* Hero */
.hero { position: relative; overflow: hidden; }
.hero-bg {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(138,90,230,0.45), transparent 60%),
    radial-gradient(900px 300px at 90% 0%, rgba(90,165,230,0.35), transparent 55%),
    linear-gradient(180deg, rgba(24,26,56,0.8), rgba(18,19,38,0.9));
}
.hero-content { padding: 72px 0 38px; text-align: left; }
.hero h1 { font-size: clamp(28px, 4vw, 42px); margin: 0 0 10px; }
.tagline { color: var(--primary-300); font-weight: 600; margin: 0 0 8px; }
.intro { color: var(--muted); margin: 0 0 26px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat-card { background: linear-gradient(180deg, rgba(30,36,80,0.85), rgba(27,32,64,0.85)); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-1); }
.stat-number { font-size: clamp(28px, 5vw, 36px); font-weight: 800; background: linear-gradient(90deg, var(--primary-300), #fff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-label { color: var(--muted); margin-top: 6px; }

/* Sections */
.section { padding: 56px 0; }
.section-alt { background: linear-gradient(180deg, rgba(24,26,56,0.6), rgba(18,19,38,0.8)); border-top: 1px solid rgba(255,255,255,0.06); border-bottom: 1px solid rgba(255,255,255,0.06); }
.section h2 { font-size: clamp(22px, 3vw, 28px); margin: 0 0 20px; letter-spacing: 0.3px; }

/* Triplet */
.triplet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.triple-item { background: rgba(30,36,80,0.5); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; transition: transform .25s ease, border-color .25s ease; }
.triple-item:hover { transform: translateY(-3px); border-color: rgba(138,90,230,0.4); }
.triple-item .icon { color: var(--primary-300); margin-bottom: 10px; }
.triple-item h3 { margin: 6px 0 8px; font-size: 18px; }
.triple-item p { margin: 0; color: var(--muted); }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card { background: rgba(18,19,38,0.6); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-1); }
.card-head { display: flex; align-items: center; gap: 10px; color: var(--primary-300); margin-bottom: 8px; }
.card h3 { margin: 0; color: var(--text); }
.card p { margin: 0 0 14px; color: var(--muted); }
.card-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Buttons */
.btn { display: inline-block; text-decoration: none; color: #fff; background: linear-gradient(90deg, var(--primary-700), var(--primary-500)); padding: 10px 14px; border-radius: var(--radius-sm); font-weight: 600; letter-spacing: 0.2px; box-shadow: 0 6px 18px rgba(138,90,230,0.25); transition: transform .2s ease, box-shadow .2s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(138,90,230,0.35); }
.btn-ghost { background: transparent; color: var(--primary-300); border: 1px solid rgba(138,90,230,0.4); }
.btn-ghost:hover { background: rgba(138,90,230,0.08); }
.btn-lg { padding: 12px 18px; border-radius: var(--radius); font-size: 15px; }

/* Timeline */
.timeline { display: grid; gap: 14px; margin-top: 8px; }
.tl-item { display: grid; grid-template-columns: 110px 1fr; gap: 14px; align-items: start; }
.tl-date { justify-self: start; background: linear-gradient(135deg, rgba(90,165,230,0.25), rgba(138,90,230,0.35)); color: #fff; border: 1px solid rgba(138,90,230,0.35); border-radius: 999px; padding: 6px 10px; font-weight: 700; letter-spacing: 0.5px; }
.tl-content { border-bottom: 1px dashed rgba(255,255,255,0.08); padding-bottom: 10px; }
.tl-title { color: #fff; text-decoration: none; font-weight: 600; }
.tl-title:hover { text-decoration: underline; }
.tl-desc { margin: 6px 0 0; color: var(--muted); }

/* CTA more */
.cta-more { margin-top: 22px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px; background: linear-gradient(90deg, rgba(91,60,196,0.3), rgba(138,90,230,0.25)); border: 1px solid rgba(138,90,230,0.35); border-radius: var(--radius-lg); padding: 18px; }
.cta-copy h3 { margin: 0 0 4px; }
.cta-copy p { margin: 0; color: var(--muted); }

/* Footer */
.site-footer { border-top: 1px solid rgba(255,255,255,0.06); background: rgba(12,14,28,0.9); }
.footer-grid { display: grid; grid-template-columns: 1fr auto; gap: 14px; padding: 20px 0; align-items: center; }
.foot-left p { margin: 0; color: var(--muted); }
.foot-right { display: flex; gap: 10px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 999px; background: rgba(30,36,80,0.6); border: 1px solid var(--line); color: #dfe3ee; }
.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #5aa5e6, #8a5ae6); box-shadow: 0 0 12px rgba(138,90,230,0.6); }

/* Utilities */
.brand-mark { display: grid; place-items: center; }

/* Responsive */
@media (max-width: 960px) {
  .stats { grid-template-columns: 1fr; }
  .triplet { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .tl-item { grid-template-columns: 90px 1fr; }
  .cta-more { grid-template-columns: 1fr; }
}

/* Collections page */
.sub-hero { position: relative; overflow: hidden; }
.sub-hero-bg { position: absolute; inset: 0; z-index: -1; background: radial-gradient(900px 280px at 0% -20%, rgba(138,90,230,0.4), transparent 55%), radial-gradient(700px 240px at 100% -10%, rgba(90,165,230,0.35), transparent 55%), linear-gradient(180deg, rgba(24,26,56,0.8), rgba(18,19,38,0.9)); }
.sub-hero-content { padding: 48px 0 28px; }

.collections-grid { display: grid; grid-template-columns: 280px 1fr 320px; gap: 16px; align-items: start; }

/* Sidebar */
.sidebar { position: sticky; top: 72px; background: rgba(18,19,38,0.6); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-1); height: fit-content; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.btn-xs { padding: 6px 10px; font-size: 12px; border-radius: 10px; }
.tree { display: grid; gap: 6px; }
.tree .node { display: grid; gap: 6px; }
.tree .node > .node-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; background: rgba(30,36,80,0.4); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.tree .node > .children { padding-left: 8px; display: grid; gap: 6px; margin-top: 6px; }
.tree .leaf { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.tree .leaf:hover { background: rgba(138,90,230,0.08); }
.count-badge { color: var(--primary-300); font-weight: 700; }
.active { outline: 1px solid rgba(138,90,230,0.5); background: rgba(138,90,230,0.08); }

/* Filters */
.filters-bar { background: rgba(18,19,38,0.6); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-1); margin-bottom: 14px; }
.filters-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.filters-meta { color: var(--muted); font-size: 13px; }
.chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip { border: 1px solid rgba(138,90,230,0.4); color: var(--primary-300); background: transparent; padding: 6px 10px; border-radius: 999px; font-weight: 600; cursor: pointer; transition: all .2s ease; }
.chip:hover { background: rgba(138,90,230,0.08); }
.chip.active { background: linear-gradient(90deg, var(--primary-700), var(--primary-500)); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(138,90,230,0.25); }
.chip-reset { border-color: rgba(90,165,230,0.5); color: #cfe9ff; }
.filters-actions { margin-top: 10px; }

/* Main list */
.paper-list { display: grid; grid-template-columns: 1fr; gap: 12px; }
.paper-card { position: relative; background: rgba(18,19,38,0.6); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-1); overflow: hidden; }
.paper-card:before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(180deg, var(--primary-700), var(--primary-500)); }
.paper-title { margin: 0 0 6px; font-size: 16px; }
.paper-meta { color: var(--muted); font-size: 13px; display: flex; gap: 10px; align-items: center; }
.paper-tags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.paper-tag { font-size: 12px; padding: 4px 8px; border-radius: 999px; background: rgba(138,90,230,0.12); color: #e8dcff; border: 1px solid rgba(138,90,230,0.3); }
.paper-actions { margin-top: 10px; display: flex; justify-content: flex-end; }

/* Right bar */
.rightbar { position: sticky; top: 72px; display: grid; gap: 16px; height: fit-content; }
.panel { background: rgba(18,19,38,0.6); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-1); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.tip-list { margin: 0; padding-left: 18px; color: var(--muted); }

@media (max-width: 1200px) {
  .collections-grid { grid-template-columns: 240px 1fr; }
  .rightbar { display: none; }
}
@media (max-width: 960px) {
  .collections-grid { grid-template-columns: 1fr; }
  .sidebar { position: relative; top: 0; }
}

/* Hover preview popover */
.popover { position: fixed; z-index: 1000; background: #ffffff; color: #121212; border-radius: 12px; box-shadow: 0 18px 48px rgba(0,0,0,0.28); border: 1px solid rgba(0,0,0,0.06); width: 360px; max-width: calc(100vw - 24px); padding: 12px 14px; display: none; }
.popover .pop-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.popover .pop-title { font-size: 14px; font-weight: 700; color: #2b2b2b; }
.popover .pop-source { font-size: 12px; color: #5b3cc4; background: rgba(91,60,196,0.08); padding: 3px 8px; border-radius: 999px; border: 1px solid rgba(91,60,196,0.25); }
.popover .pop-list { margin: 8px 0 0; padding: 0; list-style: none; }
.popover .pop-list li { margin: 6px 0; line-height: 1.5; position: relative; padding-left: 16px; color: #2b2b2b; }
.popover .pop-list li:before { content: '●'; position: absolute; left: 0; top: 0; color: #8a5ae6; font-size: 10px; line-height: 1.5; }
